package com.swq.java.code.chapter12.code07;

public class A {
    A(int v) {
        System.out.println("another constructor");
    }

    A() {
        System.out.println("default constructor");
    }

    void method() {
        System.out.println("from A");
    }

    ;

    public static void main(String args[]) {
        new A().method();  //打印from A

        System.out.println("=========");
        A a = new A() {  //匿名类
            void method() {
                System.out.println("from anonymous");
            }
        };
        a.method();  //打印from anonymous
    }
}
